package com.openecommerce.core.exception;

import com.openecommerce.core.util.StringUtils;


/**
 * 系统自定异常
 * @author Tommy
 *
 */
public class SystemException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String errorCode;
	private String errorMessage;
	private String errorResolution;
	private String errorLevle;
	
	@SuppressWarnings("unused")
	private SystemException(){
		super();
	}
	public SystemException(String message){
		super(message);
	}
	private SystemException(String message, Throwable cause) {
        super(message, cause);
    }
	@SuppressWarnings("unused")
	private SystemException(Throwable cause) {
        super(cause);
    }
	
	public SystemException(String errorCode,String errorMessage,String errorResolution,String errorLevle,Throwable cause){
		this(errorCode+"--"+errorMessage+"--"+errorLevle+"--"+errorResolution,cause);
		this.errorCode = errorCode;
		this.errorLevle = errorLevle;
		this.errorMessage = errorMessage;
		this.errorResolution = errorResolution;
	}
	
	public SystemException(String errorCode,String errorMessage,String errorResolution,String errorLevle){
		this( errorCode, errorMessage, errorResolution, errorLevle,null);
	}
	
	public String getErrorCode() {
		return errorCode;
	}
	public String getErrorMessage() {
		return errorMessage;
	}
	public String getErrorResolution() {
		return errorResolution;
	}
	public String getErrorLevle() {
		return errorLevle;
	}
	
	@Override
	public String toString(){
		return StringUtils.objectToString(this);
	}
}
